Conventionally it has often been the case that a stateless communication protocol which does not keep a connection open for a long time is used for communication between a client and a server. For example, in the case of the Hypertext Transfer Protocol (HTTP), the client establishes a Transmission Control Protocol (TCP) connection with the server in order to transmit HTTP messages, and closes the TCP connection after completing the transmission of a block of HTTP messages. Such stateless communication protocols tend to incur substantial communication costs when data transmission takes place frequently between clients and servers and when data is transmitted bi-directionally in real time.
On the other hand, a stateful communication protocol enabling a long-held connection may be used instead for a connection between a client and a server. For example, the specification of the WebSocket protocol is defined by the Internet Engineering Task Force (IETF) as Request for Comments (RFC) 6455. In the WebSocket protocol, the client and the server establish a TCP connection and transmit WebSocket messages between each other over the TCP connection. The established TCP connection need not be closed at once when transmission of a block of WebSocket messages is completed, and the client or server is able to continue to use the TCP connection to transmit subsequent WebSocket messages.
When there is no need for the client and the server to maintain the connection open any longer, one of them transmits a WebSocket message indicating a connection closure (referred to as a “close notice”) to the other. When the close notice is transmitted, the TCP connection which works on a lower communication layer than WebSocket is no longer needed and therefore closed. Compared to stateless communication protocols, stateful communication protocols reduce communication costs when data transmission takes place frequently between clients and servers and when data is transmitted bi-directionally in real time.
A session control method has been proposed which allows a terminal communicating with a second terminal to be switched from a first terminal to a third terminal during the communication. According to the proposed session control method, a local proxy running on the first terminal saves control information on a session between the first and the second terminal. In response to a terminal switch instruction from the user, the local proxy requests the second terminal to establish a session with the third terminal based on the control information. Upon receiving a message indicating the completion of the session establishment from the second terminal, the local proxy closes the session between the first and the second terminal.
There is also a proposed switching apparatus (load balancer) for distributing request messages transmitted from clients across a plurality of servers. The proposed switching apparatus establishes a TCP connection with a client and receives a request message from the client. Then, the switching apparatus selects one from a plurality of servers and establishes a TCP connection with the selected server, and then transfers the request message to the selected server. Upon receiving a FIN packet from the selected server, the switching apparatus closes the TCP connection with the server. The switching apparatus also transfers the FIN packet to the client to thereby close the TCP connection with the client.
In addition, there is a proposed system for switching a terminal to reproduce content from a first terminal to a second terminal. According to the proposed system, the first terminal establishes a session with a content server and starts receiving content from the content server. In the case of performing terminal switchover, the first terminal requests the content server to stop content delivery and informs an application server of the identifier of the session. The second terminal acquires the identifier of the session used by the first terminal from the application server and requests the content server to resume the content delivery by designating the acquired session identifier.
In addition, there is a proposed load balancer for providing services for a client using a plurality of servers upon request of the client. The proposed load balancer establishes a TCP connection with the client and receives a service request from the client. The load balancer generates an “Interest” message including identification information of the TCP connection and broadcasts the message to the servers. The load balancer selects a server responding fastest to the Interest message and establishes a session between the selected server and the client.
Further, there is a proposed relay apparatus for filtering packets encapsulated in the Secure Socket Layer (SSL) protocol according to a higher-level protocol in use. The proposed relay apparatus tests communication with a destination server using each of a plurality of higher-level protocols and determines a higher-level protocol with successful outcome. The relay apparatus infers that the higher-level protocol allowing successful communication is a higher-level protocol to be used by a client, and determines whether to relay or discard the packets according to the inferred higher-level protocol.
See, for example, Japanese Laid-open Patent Publication No. 2005-32172, International Publication Pamphlet No. WO 2006126403, International Publication Pamphlet No. WO 2010049863, Japanese Laid-open Patent Publication No. 2012-38299, and Japanese Laid-open Patent Publication No. 2012-147415.
It is sometimes the case that, when a connection is kept open between two apparatuses, switching one of the apparatuses is desired because of, for example, its workload status or the need of maintenance. For example, when a TCP connection stays open for WebSocket communication between a client and a server, switching of the server communicating with the client may be desired. However, switching one of the two apparatuses causes a change of a communication address, which prevents the continuous use of the original connection after the switching. As a result, the other apparatus is cut off from the connection and loses the communication and, therefore, needs to re-establish a connection with a post-switching apparatus. In this regard, a user may need to go through operations to access the post-switching apparatus, thus impairing the convenience of the user.
One conceivable method to mitigate the effect of switching one of the apparatuses would be to run a relay process, such as a reverse proxy, on a communication path between the two apparatuses. The relay process establishes a connection with one of the apparatuses and also establishes a different connection with the other apparatus, and then transfers messages between the two connections.
However, in general, a relay process takes no notice of the content of a message from a higher-level communication layer and simply transfers a message received from one connection to the other. Therefore, if a close instruction message at a higher-level communication layer is issued from one apparatus to the other apparatus, the close instruction message is transmitted over the relay process. This leads to a problem that the other apparatus closes the connection in response to the close instruction message. For example, a reverse proxy usually does not filter WebSocket messages and, therefore, indiscriminately transfers even a close message issued from a server to a client. Upon receiving the close message, the client closes a TCP connection. That is, even if a connection between the two apparatuses is divided into two separate connections by running the relay process, both the connections may be closed by an instruction from a higher-level communication layer.